import request from "@/utils/request";
import { PictureQuery, PicturePageResult, PictureForm } from "./model";

/**
 * 图片API
 */
class PictureAPI {
  /**
   * 获取图片分页数据
   *
   * @param queryParams
   */
  static getPage(queryParams?: PictureQuery) {
    return request<any, PicturePageResult>({
      url:
        "/picture/getPage?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }
  /**
   * 获取未关联的图片分页数据
   * @param queryParams 
   * @returns 
   */
  static getPageNoRelative(queryParams?: PictureQuery) {
    return request<any, PicturePageResult>({
      url:
        "/picture/getPageNoRelative?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }
  /**
   * 获取已关联的图片分页数据
   * @param queryParams 
   * @returns 
   */
  static getPageRelative(queryParams?: PictureQuery) {
    return request<any, PicturePageResult>({
      url:
        "/picture/getPageRelative?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }

  /**
   * 新增图片
   *
   * @param data
   */
  static add(data: PictureForm) {
    return request({
      url: "/picture/add",
      method: "post",
      data: data,
    });
  }
  /**
   * 添加到图片关联表
   * @param data 
   * @returns 
   */
  static addToRelative(data: PictureForm) {
    return request({
      url: "/picture/addToRelative",
      method: "post",
      data: data,
    });
  }

  /**
   * 修改图片
   * @param data 
   * @returns 
   */
  static update(data: PictureForm) {
    return request({
      url: "/picture/edit",
      method: "post",
      data: data,
    });
  }

  /**
   * 删除图片
   * @param data 
   * @returns 
   */
  static delete(data: PictureForm) {
    return request({
      url: "/picture/delete",
      method: "post",
      data: data,
    });
  }
  /**
   * 删除模块图片
   * @param data 
   * @returns 
   */

  static removePictureRelative(data: PictureForm) {
    return request({
      url: "/picture/removePictureRelative",
      method: "post",
      data: data,
    });
  }





}

export default PictureAPI;
